<template>
	<view class="content">
		
		<rich-text :nodes="initData"></rich-text>
	</view>
</template>

<script>
	import integral from '../../servers/integral/integral.js';
	export default {
		data() {
			return {
				code: '',
				initData:''
			}
		},
		onLoad(option) {
			this.code=option.code
		},
		onReady(){
			if(this.code=='BUYER_SHOW_RULE'){
				uni.setNavigationBarTitle({
				    title: '买家秀协议'
				});
			}else{
				uni.setNavigationBarTitle({
				    title: '兑换规则'
				});
			}
			
		},
		mounted() {
			this.initDatas();
		},
		methods: {
			initDatas(){		
				integral.rule(this.code)
					.then(res => {
						if(res.code==200){
							this.initData=res.data;
							
							
						}else{
							uni.showToast({
								title:res.msg,
								icon:'none'
							})
						}
						
					})
					.catch(err => {
						
						console.log(new Error('请检查网络后重试'));
					});
			}
		}
	}
</script>

<style scoped lang="scss" rel="stylesheet/scss">
	.content{
		padding: 30rpx;
		word-wrap:break-word;
	}
</style>
